<#assign base=request.contextPath>
<!DOCTYPE html> 
<html>
	<head>
		<title>${title}</title>
		<meta charset="utf-8">
		<#include "common/reference.ftl" />
		<#include "common/ligerui.ftl" />
		<script type="text/javascript">
		<!--
			var ligerTable = null;
			$(function(){
				ligerTable = $('#table_role').ligerGrid({
					width:'98%',
					enabledSort:false,
					pageSizeOptions:[5,10,20,50,100,200],
					height:'auto',
					alternatingRow:true,
					url:'${base}/role/getList',
					alternatingRow: false,
					columns:[
						{display:'角色ID',name:'roleId',id:'roleId',align:'center'},
						{display:'角色名称',name:'roleName',id:'roleName',align:'center'},
						{display:'角色描述',name:'roleDesc',id:'roleDesc',align:'center'},
						{
							display:'是否启用',
							name:'enabled',
							id:'enabled',
							align:'center',
							render:function(row){
								var enabled = row.enabled;
						 		if(enabled){
						 			return '是';
						 		}
						 		return '否';
							}
						}
						/*
						,
						{
							display:'操 作',
							align:'center',
							render:function(row){
								var roleId = row.roleId;
								return [ 
										'<a class="edit" href="javascript:void(0)" onclick="setMenuItem('+roleId+')"  title="设置权限">',
							                '<i class="fa fa-lock"></i>',
							            '</a>',
										'<a class="edit" href="javascript:void(0)" onclick="editItem('+roleId+')"  title="编辑">',
							                '<i class="fa fa-edit"></i>',
							            '</a>',

							            '<a class="remove" href="javascript:void(0)" onclick="removeItem('+roleId+')" title="删除">',
							                '<i class="fa fa-remove"></i>',
							            '</a>'

							            ].join('');
							}
						}
						*/
					]
				});
				
				$('#btnSearch').click(function(){
					if(ligerTable){
						var roleName = $('#txtRoleName').val();
						if(roleName == '') return;
						ligerTable.setParm('roleName',roleName);
						ligerTable.reload();
					}
				});
				
			});
			
			function setMenuItem(roleId){
				var url='${base}/role/setMenu/'+roleId;
	            changePage(url);
			}
			
		    function editItem(roleId){
	        	var url='${base}/role/edit/'+roleId;
	            changePage(url);
		    }
		    
		    function removeItem(roleId){
		    	layer.confirm('确定要删除吗？',function(){
	    			$.ajax({
	            		url:'${base}/role/remove/'+roleId,
	            		type:'POST',
	            		data:{},
	            		dataType:'json',
	            		success:function(rst){
	            			layer.msg(rst.message);
	            			if(rst.status=='OK' && ligerTable != null ){
	            				ligerTable.reload();
	            			}
	            		}
	            	});	
	    		});
		    }
		//-->
		</script>
	</head>
	<body class="${configs["skinName"]}">
		<#include "common/breadcrumb.ftl">
		<div class="widget-box">
			<div class="widget-header widget-header-flat">
				<h5 class="lighter">
					<i class="fa fa-search"></i>
					角色查询
				</h5>
			</div>
			<div class="widget-body">
				<div class="widget-main">
					<div class="row">
						<div class="col-xs-12 col-sm-5">
							<div class="input-group">
								<span class="input-group-addon">角色名称</span>
								<input id="txtRoleName" type="text" class="form-control search-query" placeholder="请输入角色名称" />
								<span class="input-group-btn">
									<button id="btnSearch" type="button" class="btn btn-primary btn-sm">
										查询
										<i class="fa fa-search bigger-110"></i>
									</button>
								</span>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
		<div class="widget-box">
			<div class="widget-header widget-header-flat">
				<h5 class="lighter">
					<i class="fa fa-table"></i>
					角色列表
				</h5>
			</div>
			<div class="widget-body">
				<div id="table_role"><div>
			</div>
		</div>
	</body>
</html>